#-*- codeing = utf-8 -*-
#@Time : 2020/11/24 19:16
#@Author : 阳某
#@File : 04.格式化字符串.py
#@Software : PyCharm

# salary = input('请输入薪资：')
#       要进行字符串拼接，只能是字符串，不能是数字
# # 计算出税后薪资
# aftertax = int(salary)*75/100
#
# # 再转化为字符串，方便下面的字符串拼接
# aftertaxStr = str(aftertax)
#
# print('税后薪资是：' + aftertaxStr)
#
# salary = input('请输入薪资：')
#
# # 计算出缴税额，存入变量tax
# tax = int(salary) *25/100
# # 转化为字符串，方便下面的字符串拼接
# taxStr = str(tax)
#
# # 计算出税后工资，存入变量aftertax
# aftertax = int(salary) *75/100
# # 转化为字符串，方便下面的字符串拼接
# aftertaxStr = str(aftertax)
#
# print('税前薪资是：' + salary + '元， 缴税：' + taxStr + '元， 税后薪资是：' + aftertaxStr + '元')


# salary = input('请输入薪资：')
# # 计算出缴税额，存入变量tax
# tax = int(salary) *25/100
# # 计算出税后工资，存入变量aftertax
# aftertax = int(salary) *75/100
# # 元组里面只有一个元素的时候一定要加逗号（a,）
# # print('税前薪资：%s元，缴税：%s元，税后薪资：%s元' %(salary,tax,aftertax))
#
# print(f'税前薪资是：{salary}元， 缴税：{tax}元， 税后薪资是：{aftertax}元')

salary = 10000
print(f'{salary:10}')

# 员工 1
salary = 8000
tax = int(salary) *25/100
aftertax = int(salary) *75/100
print(f'税前薪资是：{salary:8}元， 缴税：{tax:8}元， 税后薪资是：{aftertax:8}元')


# 员工 2
salary = 15000
tax = int(salary) *25/100
aftertax = int(salary) *75/100
print(f'税前薪资是：{salary:8}元， 缴税：{tax:8}元， 税后薪资是：{aftertax:8}元')

# 右对齐
# 员工 3
salary = 100000
tax = int(salary) *25/100
aftertax = int(salary) *75/100
print(f'税前薪资是：{salary:8}元， 缴税：{tax:8}元， 税后薪资是：{aftertax:8}元')

def calcTax(salary):
    tax = int(salary) *25/100
    aftertax = int(salary) *75/100
    print(f'税前薪资是：{salary:8}元， 缴税：{tax:8}元， 税后薪资是：{aftertax:8}元')

# 员工 1
calcTax(8000)
# 员工 2
calcTax(15000)
# 员工 3
calcTax(100000)

# 左对齐   不足8位就补空格，超过8位就不，因为指定了最小宽度8
def calcTax(salary):
    tax = int(salary) *25/100
    aftertax = int(salary) *75/100
    print(f'税前薪资是：{salary:<8}元， 缴税：{tax:<8}元， 税后薪资是：{aftertax:<8}元')

calcTax(8320)
calcTax(15023)
calcTax(100030)